
 
***This Stata do-file replicates the regression models in Feinstein and Ben-David's article "United or Divided? A Polarized Society's Response to War"***

****Data file name: UnitedDivided_data***

***Open the data file first or add here the following command to open the data file: "use [file location on the computer]/UnitedDivided_data.dta, clear"


global control_w8 "w8age w8male i.w8religious_full i.w8region i.w8educ_full i.w8leftright"
global control_w9 "w9age w9male i.w9religious_full i.w9region i.w9educ_full i.w8leftright"

svyset [pweight=w7_9weight2022]

/*Note: To export regression models in to CSV file a pair of user-written commands are used:
"eststo" following each regression stores the estimates, and "esttab" (with the list of model titles and a ".csv" suffix) export the estimates in to a csv file.
The two commands can be downloaded by typing into Stata "findit eststo" or en "findit esttab" and using the links in the pop-out screen*/

* -----------------------------
* Regression Models for Table 1
* -----------------------------

eststo clear

* --------------------
* 1. support_airstrike
svy: ologit w8support_airstrike w8anger_hamas w8fear_hammas ///
     w8responsibility_gov w8responsibility_jusicialprotest ///
     w8hamas_threat_isr w7reformsupport $control_w8
eststo w8support_airstrike

svy: ologit w9support_airstrike w8anger_hamas w8fear_hammas ///
     w9responsibility_gov w9responsibility_jusicialprotest ///
     w9hamas_threat_isr w7reformsupport $control_w9
eststo w9support_airstrike

* 2. support_ground
svy: ologit w8support_ground w8anger_hamas w8fear_hammas ///
     w8responsibility_gov w8responsibility_jusicialprotest ///
     w8hamas_threat_isr w7reformsupport $control_w8
eststo w8support_ground

svy: ologit w9support_ground w8anger_hamas w8fear_hammas ///
     w9responsibility_gov w9responsibility_jusicialprotest ///
     w9hamas_threat_isr w7reformsupport $control_w9
eststo w9support_ground

* 3. trust_idf
svy: ologit w8trust_idf w8anger_hamas w8fear_hammas ///
     w8responsibility_gov w8responsibility_jusicialprotest ///
     w8hamas_threat_isr w7reformsupport $control_w8
eststo w8trust_idf

svy: ologit w9trust_idf w8anger_hamas w8fear_hammas ///
     w9responsibility_gov w9responsibility_jusicialprotest ///
     w9hamas_threat_isr w7reformsupport $control_w9
eststo w9trust_idf


* 4. pm_sat
svy: ologit w8pm_sat w8anger_hamas w8fear_hammas ///
     w8responsibility_gov w8responsibility_jusicialprotest ///
     w8hamas_threat_isr w7reformsupport $control_w8
eststo w8pm_sat

svy: ologit w9pm_sat w8anger_hamas w8fear_hammas ///
     w9responsibility_gov w9responsibility_jusicialprotest ///
     w9hamas_threat_isr w7reformsupport $control_w9
eststo w9pm_sat

* 5. trust_netanyahu
svy: ologit w8trust_netanyahu w8anger_hamas w8fear_hammas ///
     w8responsibility_gov w8responsibility_jusicialprotest ///
     w8hamas_threat_isr w7reformsupport $control_w8
eststo w8trust_netanyahu

svy: ologit w9trust_netanyahu w8anger_hamas w8fear_hammas ///
     w9responsibility_gov w9responsibility_jusicialprotest ///
     w9hamas_threat_isr w7reformsupport $control_w9
eststo w9trust_netanyahu


* 6. trust_gov
svy: ologit w8trust_gov w8anger_hamas w8fear_hammas ///
     w8responsibility_gov w8responsibility_jusicialprotest ///
     w8hamas_threat_isr w7reformsupport $control_w8
eststo w8trust_gov

svy: ologit w9trust_gov w8anger_hamas w8fear_hammas ///
     w9responsibility_gov w9responsibility_jusicialprotest ///
     w9hamas_threat_isr w7reformsupport $control_w9
eststo w9trust_gov

* --------------------------------
* Exporting findings into csv file
* --------------------------------
esttab w8support_airstrike w9support_airstrike ///
       w8support_ground w9support_ground ///
       w8trust_idf w9trust_idf ///
       w8pm_sat w9pm_sat ///
       w8trust_netanyahu w9trust_netanyahu ///
       w8trust_gov w9trust_gov ///
       using regression_results.csv, ///
       cells(b(fmt(3)) p(fmt(3))) ///
       star(* 0.05 ** 0.01 *** 0.001) ///
       replace compress wide csv
	   
	   
* -------------------------------
* Regressions Models for Table 2
* -------------------------------
  
eststo clear

svy: regress w8anger_hamas w8hamas_threat_isr w7reformsupport $control_w8
eststo model_anger

svy: regress w8fear_hammas w8hamas_threat_isr w7reformsupport $control_w8
eststo model_fear

svy: ologit w8responsibility_gov ///
    w8hamas_threat_isr w7reformsupport $control_w8
eststo model_resp_gov

svy: ologit w8responsibility_jusicialprotest ///
    w8hamas_threat_isr w7reformsupport $control_w8
eststo model_resp_protest

* --------------------------------
* Exporting findings into csv file
* --------------------------------
esttab model_anger model_fear model_resp_gov model_resp_protest ///
    using model_outputs.csv, ///
    cells(b(fmt(3)) p(fmt(3))) ///
	star(* 0.05 ** 0.01 *** 0.001) ///
    replace compress wide csv
	   
	
* -------------------------------------------
* Testing Mediation Paths -- Appendix Table 1
* -------------------------------------------

 global indepvar_w8 "w7reformsupport w8hamas_threat_isr"
 global emotions_w8 "w8fear_hammas w8anger_hamas"
 global control_w7 "w7age w7male i.w7religious_full i.w7region i.w7educ_full i.w7leftright"
 global control_w8 "w8age w8male i.w8religious_full i.w8region i.w8educ_full i.w8leftright"  

 global gov_dependent_w8 "w8pm_sat w8trust_netanyahu w8trust_govbefore"
 global war_dependent_w8 "w8support_airstrike w8support_ground w8trust_idf"
 global responsibility_w8 "w8resp_gov_dum  w8resp_protest_dum"
 global control_w9 "w9age w9male i.w9religious_full i.w9region i.w9educ_full i.w8leftright"  

 
 global indepvar_w9 "w7reformsupport w9hamas_threat_isr "
 global dependent_w9 "w9pm_sat w9trust_netanyahu w9trust_govbefore w9support_airstrike w9support_ground w9trust_idf"
 global responsibility_w9 "w9resp_protest_dum  w9resp_gov_dum"
 preserve

 
 
  
capture program bootm68, rclass
 
 gsem ($responsibility_w8 $emotions_w8  $indepvar_w8 $control_w8 -> w8support_airstrike , family(ordinal) link (logit))($indepvar_w8 $control_w8 ->$emotions_w8, )($indepvar_w8 $control_w8 ->$responsibility_w8, family(binomial) link(logit))[pweight = w8weight2022], nocapslatent

 return scalar threat_airstike1 = _b[w8anger_hamas:w8hamas_threat_isr]*(_b[w8support_airstrike:w8anger_hamas])
end 
bootstrap r(threat_airstike1), reps(5000) : bootm68
estat boot, bc percentile


capture program bootm67, rclass
 
 gsem ($responsibility_w8 $emotions_w8  $indepvar_w8 $control_w8 -> w8support_ground , family(ordinal) link (logit))($indepvar_w8 $control_w8 ->$emotions_w8, )($indepvar_w8 $control_w8 ->$responsibility_w8, family(binomial) link(logit))[pweight = w8weight2022], nocapslatent

 return scalar threat_airstike = _b[w8anger_hamas:w8hamas_threat_isr]*(_b[w8support_ground:w8anger_hamas])
end 
bootstrap r(threat_airstike), reps(5000) : bootm67
estat boot, bc percentile


capture program bootm25, rclass
 
 gsem ($responsibility_w8 $emotions_w8  $indepvar_w8 $control_w8 -> w8trust_idf , family(ordinal) link (logit))($indepvar_w8 $control_w8 ->$emotions_w8, )($indepvar_w8 $control_w8 ->$responsibility_w8, family(binomial) link(logit))[pweight = w8weight2022], nocapslatent

 return scalar threat_idf = _b[w8anger_hamas:w8hamas_threat_isr]*(_b[w8trust_idf:w8anger_hamas])
end 
bootstrap r(threat_idf), reps(5000) : bootm25
estat boot, bc percentile
  
 
capture program bootm33, rclass
 
 gsem ($responsibility_w8 $emotions_w8  $indepvar_w8 $control_w8 -> w8pm_sat , family(ordinal) link (logit))($indepvar_w8 $control_w8 ->$emotions_w8, )($indepvar_w8 $control_w8 ->$responsibility_w8, family(binomial) link(logit))[pweight = w8weight2022], nocapslatent
 
 return scalar reform_pmsat = _b[w8resp_gov_dum:w7reformsupport]*(_b[w8pm_sat:w8resp_gov_dum])
end 
bootstrap r(reform_pmsat), reps(5000) : bootm33
estat boot, bc percentile
 
 
capture program bootm34, rclass
 
 gsem ($responsibility_w8 $emotions_w8  $indepvar_w8 $control_w8 -> w8trust_netanyahu , family(ordinal) link (logit))($indepvar_w8 $control_w8 ->$emotions_w8, )($indepvar_w8 $control_w8 ->$responsibility_w8, family(binomial) link(logit))[pweight = w8weight2022], nocapslatent
 
 return scalar reform_trustpm = _b[w8resp_gov_dum:w7reformsupport]*(_b[w8trust_netanyahu:w8resp_gov_dum])
end 
bootstrap r(reform_trustpm), reps(5000): bootm34
estat boot, bc percentile
 
 
capture program bootm37, rclass
 
 gsem ($responsibility_w8 $emotions_w8  $indepvar_w8 $control_w8 -> w8trust_govbefore , family(ordinal) link (logit))($indepvar_w8 $control_w8 ->$emotions_w8, )($indepvar_w8 $control_w8 ->$responsibility_w8, family(binomial) link(logit))[pweight = w8weight2022], nocapslatent
 
 return scalar reform_govbefore = _b[w8resp_gov_dum:w7reformsupport]*(_b[w8trust_govbefore:w8resp_gov_dum])
end 
bootstrap r(reform_govbefore), reps(5000) : bootm37
estat boot, bc percentile
 

capture program bootm40, rclass
 
 gsem ($responsibility_w9 $emotions_w8  $indepvar_w9 $control_w9 -> w9support_airstrike , family(ordinal) link (logit))($indepvar_w9 $control_w9 ->$emotions_w8, )($indepvar_w9 $control_w9 ->$responsibility_w9, family(binomial) link(logit))[pweight = w9weight2022], nocapslatent

 return scalar threat_air = _b[w8anger_hamas:w9hamas_threat_isr]*(_b[w9support_airstrike:w8anger_hamas])
end 
bootstrap r(threat_air), reps(5000) : bootm40
estat boot, bc percentile


 
capture program bootm38, rclass
 
 gsem ($responsibility_w9 $emotions_w8  $indepvar_w9 $control_w9 -> w9support_ground , family(ordinal) link (logit))($indepvar_w9 $control_w9 ->$emotions_w8, )($indepvar_w9 $control_w9 ->$responsibility_w9, family(binomial) link(logit))[pweight = w9weight2022], nocapslatent

 return scalar threat_ground = _b[w8anger_hamas:w9hamas_threat_isr]*(_b[w9support_ground:w8anger_hamas])
end 
bootstrap r(threat_ground), reps(5000) : bootm38
estat boot, bc percentile


capture program bootm42, rclass
 
 gsem ($responsibility_w9 $emotions_w8  $indepvar_w9 $control_w9 -> w9trust_idf , family(ordinal) link (logit))($indepvar_w9 $control_w9 ->$emotions_w8, )($indepvar_w9 $control_w9 ->$responsibility_w9, family(binomial) link(logit))[pweight = w9weight2022], nocapslatent

 return scalar threat_idf = _b[w8anger_hamas:w9hamas_threat_isr]*(_b[w9trust_idf:w8anger_hamas])
end 
bootstrap r(threat_idf), reps(5000) : bootm42
estat boot, bc percentile
 
 

 
capture program bootm62, rclass
 
 gsem ($responsibility_w9 $emotions_w8  $indepvar_w9 $control_w9 -> w9pm_sat , family(ordinal) link (logit))($indepvar_w9 $control_w9 ->$emotions_w8, )($indepvar_w9 $control_w9 ->$responsibility_w9, family(binomial) link(logit))[pweight = w9weight2022], nocapslatent

 return scalar reform_pmsat = _b[w9resp_gov_dum:w7reformsupport]*(_b[w9pm_sat:w9resp_gov_dum])
end 
bootstrap r(reform_pmsat), reps(5000) : bootm62
estat boot, bc percentile
 
 `
 
capture program bootm63, rclass
 
gsem ($responsibility_w9 $emotions_w8  $indepvar_w9 $control_w9 -> w9trust_netanyahu , family(ordinal) link (logit))($indepvar_w9 $control_w9 ->$emotions_w8, )($indepvar_w9 $control_w9 ->$responsibility_w9, family(binomial) link(logit))[pweight = w9weight2022], nocapslatent
 
 return scalar reform_trustpm = _b[w9resp_gov_dum:w7reformsupport]*(_b[w9trust_netanyahu:w9resp_gov_dum])
end 
bootstrap r(reform_trustpm), reps(5000): bootm63
estat boot, bc percentile'
 
 
 
capture program bootm65, rclass
 
gsem ($responsibility_w9 $emotions_w8  $indepvar_w9 $control_w9 -> w9trust_govbefore , family(ordinal) link (logit))($indepvar_w9 $control_w9 ->$emotions_w8, )($indepvar_w9 $control_w9 ->$responsibility_w9, family(binomial) link(logit))[pweight = w9weight2022], nocapslatent
 
return scalar reform_trustgov = _b[w9resp_gov_dum:w7reformsupport]*(_b[w9trust_govbefore:w9resp_gov_dum])
end 
bootstrap r(reform_trustgov), reps(5000): bootm65
estat boot, bc percentile
 
 
 
* --------------------
* Figure 2 variables+command
* -------------------- 
 
svyset [pweight=w7_9weight2022]

svy: tab w8support_airstrike
svy: tab w9support_airstrike
svy: tab w8support_ground
svy: tab w9support_ground

* --------------------
* Figure 3 variables+command
* -------------------- 
svyset [pweight=w7_9weight2022]
svy:tab w7pm_sat
svy:tab w8pm_sat
svy:tab w9pm_sat

* --------------------
* Figure 4 variables+command
* -------------------- 
svyset [pweight=w7_9weight2022]
svy:tab w7trust_netanyahu
svy:tab w8trust_netanyahu
svy:tab w9trust_netanyahu
svy:tab w7trust_gov
svy:tab w8trust_gov
svy:tab w9trust_gov
svy:tab w8trust_emergencycabinet 
svy:tab w9trust_emergencycabinet
svy:tab w7trust_idf
svy:tab w8trust_idf
svy:tab w9trust_idf

	

	
